import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import dotenv from 'dotenv';
import {resolve} from 'path'

dotenv.config();


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  define: {
    'process.env': process.env
  },
  server: {
    // 是否开启 https
    // 端口号
    host: "0.0.0.0",
    // 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
    proxy: {
      "/api": {
        // 这里填写后端地址
        target: "http://www.shimao.com",
        changeOrigin: true,
        rewrite: path => path
      },
      "/upload":{
        // 这里填写后端地址
        target: "http://www.shimao.com",
        changeOrigin: true,
        rewrite: path => path
      }
    }
  },
})
